package cn.itcast.nio.c4;

import java.io.IOException;
import java.net.InetSocketAddress;
import java.net.SocketAddress;
import java.nio.channels.SocketChannel;
import java.nio.charset.Charset;

/**
 * @Author: LDeng
 * @Date: 2021-05-11 16:47
 */
public class Client {

    public static void main(String[] args) throws IOException {
        SocketChannel sc = SocketChannel.open();
        sc.connect(new InetSocketAddress("localhost",8080));
        SocketAddress address = sc.getLocalAddress();

        //sc.write(Charset.defaultCharset().encode("1234512345abc\ndef"));
        sc.write(Charset.defaultCharset().encode("12345\n12345asdfasdf\nasdgadsfgadffag1fasdfadsfadsga34512345\n"));
        System.in.read();
    }

}
